package Arithmetic;

public class ValueDemo1 {
    public static void main(String[] args) {
        // 定义整数变量
        int a = 10;
        int b = 3;

        // 定义浮点数变量
        double x = 10.5;
        double y = 3.2;

        // 加法运算
        int sumInt = a + b;
        double sumDouble = x + y;

        // 减法运算
        int differenceInt = a - b;
        double differenceDouble = x - y;

        // 乘法运算
        int productInt = a * b;
        double productDouble = x * y;

        // 除法运算
        int quotientInt = a / b; // 整数除法，结果为整数
        double quotientDouble = x / y;

        // 取模运算
        int remainderInt = a % b;
        double remainderDouble = x % y;

        // 输出结果
        System.out.println("整数加法: " + a + " + " + b + " = " + sumInt); // 整数加法: 10 + 3 = 13
        System.out.println("浮点数加法: " + x + " + " + y + " = " + sumDouble); // 浮点数加法: 10.5 + 3.2 = 13.7
        System.out.println("整数减法: " + a + " - " + b + " = " + differenceInt); // 整数减法: 10 - 3 = 7
        System.out.println("浮点数减法: " + x + " - " + y + " = " + differenceDouble); // 浮点数减法: 10.5 - 3.2 = 7.3
        System.out.println("整数乘法: " + a + " * " + b + " = " + productInt); // 整数乘法: 10 * 3 = 30
        System.out.println("浮点数乘法: " + x + " * " + y + " = " + productDouble); // 浮点数乘法: 10.5 * 3.2 = 33.6
        System.out.println("整数除法: " + a + " / " + b + " = " + quotientInt); // 整数除法: 10 / 3 = 3
        System.out.println("浮点数除法: " + x + " / " + y + " = " + quotientDouble); // 浮点数除法: 10.5 / 3.2 = 3.28125
        System.out.println("整数取模: " + a + " % " + b + " = " + remainderInt); // 整数取模: 10 % 3 = 1
        System.out.println("浮点数取模: " + x + " % " + y + " = " + remainderDouble); // 浮点数取模: 10.5 % 3.2 = 1.0999999999999996
    }
}
